﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2012-02-18 13:24:46Z</CreationDate>
</File>
*/
#endregion

using Outcoder.Messaging;
using Outcoder.Services;

namespace Outcoder.SettingsModel
{
	/* TODO: [DV] Comment. */
	public class SettingsEventBroadcaster
	{
		public SettingsEventBroadcaster(ISettingsService settingsService)
		{
			ArgumentValidator.AssertNotNull(settingsService, "settingsService");
			settingsService.SettingChanging += HandleSettingChanging;
			settingsService.SettingChanged += HandleSettingChanged;
		}

		void HandleSettingChanging(object sender, SettingChangingEventArgs e)
		{
			var messageBus = Dependency.Resolve<IMessenger, Messenger>();
			messageBus.Publish(e);
		}

		void HandleSettingChanged(object sender, SettingChangeEventArgs e)
		{
			var messageBus = Dependency.Resolve<IMessenger, Messenger>();
			messageBus.Publish(e);
		}
	}
}
